package org.wkg.lesson02;

public class Demo_204 {

    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            for (int i = 10; i >=0 ; i--) {
                try {
                    System.out.println(Thread.currentThread().getName() + ": 我还活着");
                    Thread.sleep(1 * 1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(Thread.currentThread().getName() + ": 我即将死去");
        });

        System.out.println(thread.getName() + " :Id: " + thread.getId());
        System.out.println(thread.getName() + " :Name: " + thread.getName());
        System.out.println(thread.getName() + " :State: " + thread.getState());
        System.out.println(thread.getName() + " :Priority: " + thread.getPriority());
        System.out.println(thread.getName() + " :isDaemon: " + thread.isDaemon());
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());

        thread.start();

        while (thread.isAlive()) {

        }
        System.out.println(thread.getName() + " :状态: " + thread.getState());
    }
}
